package com.test.t1;

import com.test.ext.ExtConfig;
import org.junit.Test;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @author lzy
 * @version v1.0
 * Create DateTime: 2018/12/1 11:00
 */
public class IocTest_ext {
    @Test
    public void test01() {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ExtConfig.class);

        // 发布事件
        context.publishEvent(new ApplicationEvent("我发布的事件") {
            private static final long serialVersionUID = -5785356654619421852L;

            @Override
            public Object getSource() {
                return super.getSource();
            }
        });
        context.close();
    }
}
